using UnityEngine;
using System.Collections;

public class TrackConstructionJob : ConstructionJob {
	
	int startX, startY, startZ;
	int endX, endY, endZ;
	
	public TrackConstructionJob(int nstartX, int nstartY, int nstartZ, int nendX, int nendY, int nendZ)
			:base(nstartX, nstartY, nstartZ)
	{
		startX = nstartX;
		startY = nstartY;
		startZ = nstartZ;
		
		endX = nendX;
		endY = nendY;
		endZ = nendZ;
	}
	
	public bool workOn(double workspeed, Robot robot){
		bool isDone = base.workOn(workspeed, robot);
		
		if (isDone){
			SplineControlPoint[] points = new SplineControlPoint[3];
			points[0] = new SplineControlPoint(new Vector3((float) (startX), (float)(startY), (float)(startZ)),
					new Vector3(-1,-1,-1), new float[] {50, 50});
			points[1] = new SplineControlPoint(new Vector3((float)(endX), (float)(endY), (float)(endZ)),
					new Vector3(-1,-1,-1), new float[] {50, 50});
			
			Spline3D[] trackSections = TrackFactory.genTrack(points, TrackFactory.rail);
			
		}
		return isDone;
	}
	
}
